package com.study.design.pattern.pattern.creational.singleton.lazy.common;

public class Singleton {
    private static Singleton INSTANCE = null;

    private Singleton() {
        // 私有构造函数
    }

    /**
     * 加锁是为了防止多线程场景下的并发问题
     */
    public static synchronized Singleton getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new Singleton();
        }
        return INSTANCE;
    }
}
